package com.ruoyi.paipan.common;

public class Holiday {
    private String day;
    private String name;
    private Boolean work = false;
    private String target;

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getWork() {
        return work;
    }

    public void setWork(Boolean work) {
        this.work = work;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    @Override
    public String toString() {
        return this.day + " " + this.name + (this.work ? "调休" : "") + " " + this.target;
    }

    public Holiday(String day, String name, Boolean work, String target) {
        if(day.indexOf('-') > 0){
            this.day = day;
        }else{
            this.day = day.substring(0, 4)+"-"+day.substring(4,6)+"-"+day.substring(6);
        }

        this.name = name;
        this.work = work;
        if(day.indexOf('-') > 0){
            this.target = target;
        }else{
            this.target = target.substring(0,4)+"-"+target.substring(4,6)+"-"+target.substring(6);
        }
    }
}
